﻿using WebApiClientCore;
using WebApiClientCore.Attributes;
using BPM.Web.Shared.Data;
namespace BPM.Web.Shared.Service;

public interface ICodeGenClient : IHttpApi
{
    /// <summary>
    /// 分页查询
    /// </summary>
    /// <param name="databaseName">数据库名</param>
    /// <param name="tableName">数据库表名</param>
    /// <param name="searchValue">搜索值</param>
    /// <param name="pageNo">当前页码</param>
    /// <param name="pageSize">页码容量</param>
    /// <param name="searchBeginTime">搜索开始时间</param>
    /// <param name="searchEndTime">搜索结束时间</param>
    /// <param name="sortField">排序字段</param>
    /// <param name="sortOrder">排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend)</param>
    /// <param name="descStr">降序排序(不要问我为什么是descend不是desc，前端约定参数就是这样)</param>
    /// <param name="searchParameters">复杂查询条件</param>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpGet("codeGenerate/page")]
    ITask<XnRestfulResult<PageResult<SysCodeGen>>> Page17Async(CodegenPageInput body, CancellationToken token = default);

    /// <summary>
    /// 增加
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpPost("codeGenerate/add")]
    Task<XnRestfulResult<string>> Add13Async(AddCodeGenInput body, CancellationToken token = default);

    /// <summary>
    /// 删除
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpPost("codeGenerate/delete")]
    Task<XnRestfulResult<string>> Delete17Async(IEnumerable<DeleteCodeGenInput> body, CancellationToken token = default);

    /// <summary>
    /// 更新
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpPost("codeGenerate/edit")]
    Task<XnRestfulResult<string>> Edit14Async(UpdateCodeGenInput body, CancellationToken token = default);

    /// <summary>
    /// 详情
    /// </summary>
    /// <param name="id">主键Id</param>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpGet("codeGenerate/detail")]
    ITask<XnRestfulResult<SysCodeGen>> DetailGET15Async(QueryCodegenInput body, long id, CancellationToken token = default);

    /// <summary>
    /// 获取数据库库集合
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpGet("codeGenerate/DatabaseList")]
    ITask<XnRestfulResult<List<DatabaseOutput>>> DatabaseListAsync(CancellationToken token = default);

    /// <summary>
    /// 获取数据库表(实体)集合
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpGet("codeGenerate/InformationList")]
    ITask<XnRestfulResult<List<TableOutput>>> InformationListAsync(string dbContextLocatorName, CancellationToken token = default);

    /// <summary>
    /// 根据表名获取列
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpGet("codeGenerate/ColumnList/{databaseName}/{tableName}")]
    ITask<XnRestfulResult<List<TableColumnOuput>>> ColumnListAsync(string databaseName, string tableName, CancellationToken token = default);

    /// <summary>
    /// 代码生成_本地项目
    /// </summary>
    /// <returns>Success</returns>
    /// <exception cref="ApiException">A server side error occurred.</exception>
    [HttpPost("codeGenerate/runLocal")]
    Task<XnRestfulResult<string>> RunLocalAsync(SysCodeGen body, CancellationToken token = default);
}
